import {
	RouterMount,
	createRouter
} from 'uni-simple-router';
const url = "index/index"
let routerList = []
for (let vo of ROUTES) {
	let path = vo.path.replace('/pages/','')
	vo.component = resolve => {
			require([`@/pages/${path}`], resolve)
	}
	if(vo.aliasPath) {
		console.log(vo.aliasPath)
		vo.path = '/'
	}
	if(vo.path!='/pages/layout/layout') {
		routerList.push(vo)
	}
	
}
const router = new createRouter({
	platform: process.env.VUE_APP_PLATFORM,
	h5: {
		vueRouterDev: true, //完全使用vue-router开发 默认 false
	},
	routes: [
		...routerList
	]
})
router.beforeEach((to, from, next) => {
	//路由守卫
	console.log(to,from)
	next()
})

export {
	router,
	RouterMount
};
